package com.ssl.tensquare.common.entity;

import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Type;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 描述：
 *
 * @author ssl
 * @create 2019/06/11 10:16
 */
@Getter
@Setter
@MappedSuperclass
@EntityListeners(AuditingEntityListener.class)
public abstract class BaseEntity implements Serializable {
    @Id
    private String id;

    /**
     * 创建者id
     */
    private String createBy;
    /**
     * 更新者
     */
    private String modifyBy;
    @CreatedDate
    private Date createTime;
    @LastModifiedDate
    private Date modifyTime;

    /**
     * 是否删除
     */
    @Type(type = "org.hibernate.type.NumericBooleanType")
    @Column(name = "del_flag", nullable = false, length = 1)
    private Boolean delFlag;
    @Version
    private Long version;

}
